package tt.lab.pmbok.dao;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import tt.lab.pmbok.model.Area;
import tt.lab.pmbok.model.Inout;

public class InoutDaoHibernate  implements InoutDao {
	@Resource(name = "sessionFactory")
	private SessionFactory sessionFactory;
	

	private Session getSession(){
		return sessionFactory.getCurrentSession();
	}
	
	public Inout load(int id) {
		return (Inout) getSession().load(Inout.class, id);
		
		
	}

	public List<Inout> loadAll() {
		Query query;
		String hql = "from "+Inout.class.getName();
		query = getSession().createQuery(hql);
		List<Inout> list = (List<Inout>) query.list();
		return list;
	}


}
